package com.czy.tank.config;

import java.io.IOException;
import java.util.Properties;

/********************************************************************
 * @brief 配置文件类
 * @version 0.1
 * @date 2022年09月01日 16:44
 * @author changziyang
 ********************************************************************/
public class PropertyMgr {

    private static final PropertyMgr INSTANCE = new PropertyMgr();

    private PropertyMgr(){}

    public static PropertyMgr getInstance(){
        return INSTANCE;
    }
    static Properties props = new Properties();

    static {
        try {
            props.load(PropertyMgr.class.getClassLoader().getResourceAsStream("config"));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public Object get(String key) {
        if(props == null) return null;
        return props.get(key);
    }

    public Integer getInt(String key) {
        if(props == null) return null;
        return Integer.valueOf(props.get(key).toString());
    }

}
